<?php

namespace api\response;

class Response
{
    public static function err(/* string */$msg, array $data, /* int */$code = 500) {
        printf("{\"code\":%d,\"data\":\"%s\",\"msg\":\"%s\"}",
            $code, json_encode($data), addslashes($msg));
        return $code;
    }

    public static function succ(/* string */$msg, array $data, /* int */$code = 200) {
        printf("{\"code\":%d,\"data\":%s,\"msg\":\"%s\"}",
            $code, json_encode($data), addslashes($msg));
        return $code;
    }
}